package com.happystreet.ui
{
	import com.happystreet.engine.CoreObject;
	
	import flash.display.MovieClip;
	import flash.events.MouseEvent;
	
	public class CoreButton extends CoreObject
	{
		private var downHandler:Function;
		private var clickHandler:Function;
		private var outHandler:Function;
		private var upHandler:Function;
		private var overHandler:Function;
		private var soundId:String;
		private var isActivated:Boolean;
		public function CoreButton(className:String=null, content:MovieClip=null)
		{
			super(className, content);
		}
		/**
		 *注册回调处理 
		 * @param down
		 * @param click
		 * @param out
		 * @param up
		 * @param over
		 * 
		 */		
		public function registerHandlers(down:Function, click:Function=null, out:Function=null, up:Function=null, over:Function=null):void
		{
			this.downHandler = down;
			this.clickHandler = click;
			this.outHandler = out;
			this.upHandler = up;
			this.overHandler = over;
		}
		/**
		 *设置点击音效ID 
		 * @param soundID
		 * 
		 */		
		public function setClickSound(soundID:String=null):void
		{
			this.soundId = soundID;
		}
		
		/**
		 *激活按钮 
		 * 
		 */		
		public function activateButton():void
		{
			isActivated = true;
			this.addEventListener(MouseEvent.MOUSE_OVER, this.onMouseOver, false, 0, true);
			this.addEventListener(MouseEvent.MOUSE_DOWN, this.onMouseDown, false, 0, true);
			this.addEventListener(MouseEvent.MOUSE_UP, this.onMouseUp, false, 0, true);
			this.addEventListener(MouseEvent.CLICK, this.onMouseClick, false, 0, true);
			this.addEventListener(MouseEvent.MOUSE_OUT, this.onMouseOut, false, 0, true);
		}
		
		override public function createTooltip(_arg1:String, _arg2:int=0, _arg3:int=0, _arg4:Boolean=false, _arg5:Boolean=false, _arg6:Boolean=false):void
		{
			
		}
		
		private function onMouseOver(event:MouseEvent):void
		{
			
		}
		
		private function onMouseDown():void
		{
			
		}
		
		private function onMouseUp():void
		{
			
		}
		
		private function onMouseClick():void
		{
			
		}
		
		private function onMouseOut():void
		{
			
		}
	}
}